package mr.ali.webvideo.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import mr.ali.webvideo.model.CollectionUserMony;
import mr.ali.webvideo.mapper.CollectionUserMonyMapper;
import mr.ali.webvideo.service.ICollectionUserMonyService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author Mr-ali
 * @since 2025-08-16
 */
@Service
public class CollectionUserMonyServiceImpl extends ServiceImpl<CollectionUserMonyMapper, CollectionUserMony> implements ICollectionUserMonyService {

    @Resource
    private CollectionUserMonyMapper collectionUserMonyMapper;
    @Override
    public List<CollectionUserMony> getCollectionUserMonyList(Integer userId) {
        QueryWrapper<CollectionUserMony> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("user_id", userId);
        queryWrapper.orderByDesc("gmt_create");
        return collectionUserMonyMapper.selectList(queryWrapper);
    };

    @Override
    public void insertCollectionUserMony(CollectionUserMony collectionUserMony) {
        collectionUserMonyMapper.insert(collectionUserMony);
    }
}
